import request from '@/router/axios';

// 获取采购计划列表
export const getInquiryinfoList = (current, size, params) => {
  return request({
    url: '/api/blade-purchase/inquiryinfo/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

// 根据物料组获取供应商列表
export const getSupplierByMaterialGroupNo = (materialGroupNo,supplierNo,params) => {
  return request({
    url: '/api/blade-purchase/inquiryinfo/getSupplierByMaterialGroupNo',
    method: 'get',
    params: {
      materialGroupNo,
      supplierNo,
      ...params
    }
  })
}

// 根据采购计划id获取物料信息
export const getMaterialList = (id) => {
  return request({
    url: '/api/blade-purchase/purchaseplan/detailNew',
    method: 'get',
    params: {id}
  })
}

// 更改询价单状态信息
export const changeInquiryStatus = (ids,state) => {
  return request({
    url: '/api/blade-purchase/inquiryinfo/changeInquiryStatus',
    method: 'post',
    params: {
      ids,
      state
    }
  })
}

// 删除
export const remove = (ids) => {
  return request({
    url: '/api/blade-purchase/inquiryinfo/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

// 保存询价单
export const saveInquiryInfo = (data) => {
  return request({
    url: '/api/blade-purchase/inquiryinfo/save',
    method: 'post',
    data: data
  })
}

// 查看&编辑
export const detail = (id) => {
  return request({
    url: '/api/blade-purchase/inquiryinfo/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 获取当前登录人信息
export const getCurrentLogin = (userId) => {
  return request({
    url: '/api/blade-purchase/inquiryinfo/getCurrentLogin',
    method: 'get',
    params: {
      userId
    }
  })
}

export const startProcess = (id) => {
  return request({
    url: '/api/blade-purchase/inquiryinfo/start-process',
    method: 'get',
    params: {
      id
    }
  })
}
